<?php
$this->pageTitle = Yii::app()->name . ' - ' . Yii::t("UserModule.user", "Create a Profile");
$this->breadcrumbs = array(
    Yii::t("UserModule.user", "Profile"),
);
?>
<div class="span12">	            	
    <ul class="breadcrumb">
        <li class="previous"><a href="<?php echo SITE_URL; ?>">Home /</a></li>
        <li class="disable"><a href="javascript:void(0);">Update Profile</a></li>
    </ul>   
    <div class="common">
        <div class="whiteBg blueBor padding20px">
            <h5 class="fnt-size20"><?php echo Yii::t("UserModule.user", 'Update Profile'); ?></h5>
        </div>
    </div>
    <div class="common">
        <?php if (Yii::app()->user->hasFlash('profileMessage')): ?>
            <div class="success">
                <?php echo Yii::app()->user->getFlash('profileMessage'); ?>
            </div>
        <?php endif; ?>
        <?php
        $form = $this->beginWidget('GxActiveForm', array(
            'id' => 'profile-form',
            'clientOptions' => array(
                'validateOnSubmit' => true,
                'validateOnChange' => true,
            ),
            'htmlOptions' => array('enctype' => 'multipart/form-data', 'class' => 'remmarginB'),
                ));
        ?>
        <p class="note"><?php echo Yii::t("UserModule.user", 'Fields with <span class="required">*</span> are required.'); ?></p>

        <?php /* echo $form->errorSummary($profile); */ ?>
        <?php /* echo $form->errorSummary($corporateprogram); */ ?>
        <fieldset>
            <div class="createBox addmarginB20">
                <h4 class="txtfff fnt-size20">Personal Information</h4>
                <div class="padding20px">
                    <div class="formElements">
                        <div class="userProfile addmarginB20">
                            <div class="col1 box" id="userPhoto" style="padding:1px;">
                                <?php if (!$profile->photo) { ?>
                                    <img src="<?php echo baseUrl() . '../../upload/'; ?>default-male.jpg" title="No Photo" height="151px" width="150px" />
                                <?php } else { ?>
                                    <img src="<?php echo baseUrl() . '../../' . $userFolder . 'profile/thumb/' . $profile->photo; ?>" title="My Photo" />
                                    <div class="overlay"><a href="javascript:void(0);" onclick="return deletePhoto();"><img src="<?php echo baseUrl() . '../../upload/delete.png'; ?>" />Delete Profile Picture</a></div>
                                <?php } ?> 
                            </div>
                            <div class="col2">                                      
                                <div class="uploadButton remmargin addmarginT10"> 
                                    <?php
                                    $this->widget('common.extensions.EAjaxUpload.EAjaxUpload', array(
                                        'id' => 'uploadFile',
                                        'config' => array(
                                            'action' => Yii::app()->createUrl('user/profile/uploadphoto/id/' . $profile->profile_id),
                                            'allowedExtensions' => array("jpg", "jpeg", "gif", "png", "JPG", "JPEG", "GIF", "PNG"), //array("jpg","jpeg","gif","exe","mov" and etc...
                                            'sizeLimit' => 2 * 1024 * 1024, // maximum file size in bytes
                                            'minSizeLimit' => 1 * 1024, // minimum file size in bytes
                                            'onComplete' => "js:function(id, fileName, responseJSON){ 
				if(responseJSON.success){
				$('#userPhoto').html('<img src=\"" . baseUrl() . "../../" . $userFolder . "profile/thumb/'+responseJSON.filename+'\" /><div class=\"overlay\"><a href=\"javascript:void(0);\" onclick=\"return deletePhoto();\"><img src=\"" . baseUrl() . "../../upload/delete.png\" />Delete Profile Picture</a></div>');
				}
			   
			   }"
                                        )
                                    ));
                                    ?>
                                    <p><?php echo SkillConfig::MAX_IMAGE_SIZE; ?></p>
                                </div>
                                <div class="clear"></div>
                            </div>                                             
                        </div>  
                        <div class="alert alert-success" style=" margin-left:350px;width:250px;display:none;">Your password has been changed successfully.</div>
                        <script>$(document).ready(function(){$(".myinline").colorbox({inline:true, width:"40%"});});</script>
                        <a class='myinline' style="width:300px; height:100px; margin-left:100px;" href="#myinline_content">Change-Password</a>
                        <div style='display:none'>
                            <div id='myinline_content'  style='padding:10px; background:#fff;'>
                                <?php
                                $this->renderPartial('/profile/_changepassword');
                                ?>
                            </div>
                        </div>
                        <div class="clear"></div>                                                                     
                        <div class="col-3">                                               
                            <div class="common">                              
                                    <?php echo $form->labelEx($profile, 'first_name'); ?><em title="Please Enter First name+Lastname or display name" class="sprite question-sign">&nbsp;</em>
                                    <?php echo $form->textField($profile, 'first_name', array('title' => 'First Name', 'class' => 'field')); ?>
                                    <?php echo $form->error($profile, 'first_name'); ?>
                               
                                <div class="clear"></div>
                            </div>
                            <div class="common">
                                <div class="col col1">
                                    <?php echo $form->labelEx($profile, 'phone'); ?>
                                    <?php echo $form->textField($profile, 'phone', array('title' => 'Phone Number', 'class' => 'field')); ?>
                                    <?php echo $form->error($profile, 'phone'); ?>
                                </div>
                                <div class="col col2">
                                    <?php echo $form->labelEx($profile, 'date_of_birth'); ?><em title="Your date of birth" class="sprite question-sign">&nbsp;</em>
                                    <?php
                                    $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                                        'model' => $profile,
                                        'attribute' => 'date_of_birth',
                                        'value' => ($profile->date_of_birth == '') ? date('d-m-Y') : $profile->date_of_birth,
                                        'options' => array(
                                            'dateFormat' => 'yy-mm-dd',
                                            'showAnim' => 'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
                                            'changeMonth' => true,
                                            'changeYear' => true,
                                            'yearRange' => '2000:2099',
                                            'minDate' => '1950-01-01', // minimum date
                                            'maxDate' => "+0D",
                                        ),
                                        'htmlOptions' => array(
                                            'class' => 'field',
                                            'placeholder' => 'date of birth',
                                        ),
                                    ));
                                    ?>   

                                    <?php echo $form->error($profile, 'date_of_birth'); ?>
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div><?php echo $form->labelEx($profile, 'about'); ?><em title=" <?php echo Message::PROFILE_ABOUT; ?>" class="sprite question-sign">&nbsp;</em></div>		
                            <div class="clear"></div>										
                            <div class="common"> 
                                <?php
                                $this->widget('common.extensions.ckeditor.CKEditor', array(
                                    'model' => $profile,
                                    'attribute' => 'about',
                                ));
                                ?>
                                <?php echo $form->error($profile, 'about'); ?>
                                <div class="clear"></div>
                            </div>
                            <div><?php echo $form->labelEx($profile, 'experience'); ?><em title="Tell us your experience" class="sprite question-sign">&nbsp;</em></div>		
                            <div class="clear"></div>
                            <div class="common">                                                   
                                <?php
                                $this->widget('common.extensions.ckeditor.CKEditor', array(
                                    'model' => $profile,
                                    'attribute' => 'experience',
                                ));
                                ?>
                                <?php echo $form->error($profile, 'experience'); ?>
                                <div class="clear"></div>
                            </div>
                            <div><?php echo $form->labelEx($profile, 'other_info'); ?><em title="Tell us your other information" class="sprite question-sign">&nbsp;</em></div>		
                            <div class="clear"></div>
                            <div class="common">
                                <?php
                                $this->widget('common.extensions.ckeditor.CKEditor', array(
                                    'model' => $profile,
                                    'attribute' => 'other_info',
                                ));
                                ?>
                                <?php echo $form->error($profile, 'other_info'); ?>
                                <div class="clear"></div>
                            </div>
                            <div class="common">
                                <input class="ffCheckbox" type="checkbox" name="isCorporate" id="isCorporate" value="1" <?php if ($isCorporate || $corporateprogram->bank_name <> "") { ?> checked="checked" <?php } ?>  onclick="return showCorporate(this.id);"><label>Would you like to be included as a trainer in our corporate program</label><em class="sprite question-sign">&nbsp;</em>
                            </div>
                            <!-- Here corporate program-->
                            <div id="corporateIdA">
                                <div class="common">
                                    <div class="height1px dash-borB rempaddingB"></div>
                                    <h5 class="txttTransformNorml txt737 fntweghtNml addpaddingTB10 fnt-size20 font-georgia">Bank Account Details</h5>
                                    <div class="height1px dash-borB rempaddingB"></div>
                                </div>
                                <div class="common">
                                    <div class="col col1">
                                        <?php echo $form->labelEx($corporateprogram, 'bank_name'); ?><em class="sprite question-sign">&nbsp;</em>
                                        <?php echo $form->textField($corporateprogram, 'bank_name', array('maxlength' => 45, 'title' => 'Bank Name', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'bank_name'); ?>
                                    </div>
                                    <div class="col col2">
                                        <?php echo $form->labelEx($corporateprogram, 'account_number'); ?><em class="sprite question-sign">&nbsp;</em>
                                        <?php echo $form->textField($corporateprogram, 'account_number', array('maxlength' => 45, 'title' => 'Bank Account Number', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'account_number'); ?>
                                    </div>
                                    <div class="col col3">
                                        <?php echo $form->labelEx($corporateprogram, 'IFS_code'); ?><em class="sprite question-sign">&nbsp;</em>
                                        <?php echo $form->textField($corporateprogram, 'IFS_code', array('maxlength' => 45, 'title' => 'IFS Code', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'IFS_code'); ?>
                                    </div>
                                    <div class="clear"></div>
                                </div>												  
                                <div class="common">
                                    <div class="col col1">
                                        <?php echo $form->labelEx($corporateprogram, 'PAN'); ?><em class="sprite question-sign">&nbsp;</em>
                                        <?php echo $form->textField($corporateprogram, 'PAN', array('maxlength' => 45, 'title' => 'PAN Number', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'PAN'); ?>
                                    </div>
                                    <div class="col col2">
                                        <?php echo $form->labelEx($corporateprogram, 'branch_name'); ?>
                                        <?php echo $form->textField($corporateprogram, 'branch_name', array('maxlength' => 45, 'title' => 'Bank Branch Name', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'branch_name'); ?>
                                    </div>
                                    <div class="col col3">
                                        <?php echo $form->labelEx($corporateprogram, 'account_holder_name'); ?><em class="sprite question-sign">&nbsp;</em>
                                        <?php echo $form->textField($corporateprogram, 'account_holder_name', array('maxlength' => 45, 'title' => 'Bank Account Holder Name', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'account_holder_name'); ?>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                                <div class="common">
                                    <div class="col col1">
                                        <?php echo $form->labelEx($corporateprogram, 'account_type'); ?>
                                        <?php echo $form->dropDownList($corporateprogram, 'account_type', array("current" => "Current", "saving" => "Saving"), array('empty' => 'Select Account Type', 'title' => 'Bank Account Type', 'class' => 'actype')); ?>
                                        <?php echo $form->error($corporateprogram, 'account_type'); ?>
                                    </div>
                                    <div class="col col2">
                                        <?php echo $form->labelEx($corporateprogram, 'service_tax'); ?>
                                        <?php echo $form->textField($corporateprogram, 'service_tax', array('maxlength' => 45, 'title' => 'Service Tax Number', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'service_tax'); ?>
                                    </div>
                                    <div class="col col3">
                                        <?php echo $form->labelEx($corporateprogram, 'TDS'); ?>
                                        <?php echo $form->textField($corporateprogram, 'TDS', array('maxlength' => 45, 'title' => 'TDS Number', 'class' => 'field')); ?>
                                        <?php echo $form->error($corporateprogram, 'TDS'); ?>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                            </div>
                            <!-- End corporate program-->
                            <div class="createBox addmarginB20">
                                <div class="common">
                                    <div class="height1px dash-borB rempaddingB"></div>
                                    <h5 class="txttTransformNorml txt737 fntweghtNml addpaddingTB10 fnt-size20 font-georgia">Social Network Details</h5>
                                    <div class="height1px dash-borB rempaddingB"></div>
                                </div>
                                <div class="col-3">                                               
                                    <div class="common">
                                        <div class="col col1">
                                            <?php echo $form->labelEx($profile, 'facebook'); ?>
                                            <?php echo $form->textField($profile, 'facebook', array('maxlength' => 45, "placeholder" => "Link", 'title' => 'Facebook Link', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'facebook'); ?>
                                        </div>
                                        <div class="col col2">
                                            <?php echo $form->labelEx($profile, 'twitter'); ?>
                                            <?php echo $form->textField($profile, 'twitter', array('maxlength' => 45, "placeholder" => "Link", 'title' => 'Twitter Link', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'twitter'); ?>
                                        </div>
                                        <div class="col col3">
                                            <?php echo $form->labelEx($profile, 'linkedin'); ?>
                                            <?php echo $form->textField($profile, 'linkedin', array('maxlength' => 45, "placeholder" => "Link", 'title' => 'Linkedin Link', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'linkedin'); ?>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>
                                <div class="ls-col">
                                    <div class="common">
                                        <div class="s-col">
                                            <?php echo $form->labelEx($profile, 'website_title'); ?>
                                            <?php echo $form->textField($profile, 'website_title', array('maxlength' => 45, "placeholder" => "Title", 'title' => 'Website Title', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'website_title'); ?>
                                        </div>
                                        <div class="l-col">
                                            <?php echo $form->labelEx($profile, 'website_link'); ?>
                                            <?php echo $form->textField($profile, 'website_link', array('maxlength' => 45, "placeholder" => "Link", 'title' => 'Website Link', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'website_link'); ?>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                    <div class="common">
                                        <div class="s-col">
                                            <?php echo $form->labelEx($profile, 'blog_title'); ?>
                                            <?php echo $form->textField($profile, 'blog_title', array('maxlength' => 45, "placeholder" => "Title", 'title' => 'Blog Title', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'blog_title'); ?>
                                        </div>
                                        <div class="l-col">
                                            <?php echo $form->labelEx($profile, 'blog_link'); ?>
                                            <?php echo $form->textField($profile, 'blog_link', array('maxlength' => 45, "placeholder" => "Link", 'title' => 'Blog Link', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'blog_link'); ?>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                    <div class="common">
                                        <div class="s-col">
                                            <?php echo $form->labelEx($profile, 'others'); ?>
                                            <?php echo $form->textField($profile, 'others', array('maxlength' => 45, "placeholder" => "Title", 'title' => 'Other Title', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'others'); ?>
                                        </div>
                                        <div class="l-col">
                                            <?php echo $form->labelEx($profile, 'others_link'); ?>
                                            <?php echo $form->textField($profile, 'others_link', array('maxlength' => 45, "placeholder" => "Link", 'title' => 'Other Link', 'class' => 'field')); ?>
                                            <?php echo $form->error($profile, 'others_link'); ?>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>                                      
                            </div>											
                        </div>
                    </div>
                </div>
            </div>
            <div class="common whiteBg">
                <div class="padding20px">
                    <p class="font-opensansbd fnt-size14">Terms &amp; Condition</p>
                    <div class="greenBor radius4px addmarginB20">
                        <div id="termsBox" class="padding20px">
                            <?php echo $termcondition_value; ?>
                        </div>
                    </div>
                    <p class="font-opensansbd fnt-size14">About SkillHippo and the Platform</p>
                    <div class="flatui"> 
                        <?php
                        $checked = '';
                        if ($profile->first_name <> "") {
                            $checked = 'checked';
                        }
                        ?>

                        <?php echo $form->checkbox($profile, 'termcondition', array('checked' => $checked)); ?>
                        <label for="Profile_termcondition">I have read the terms &amp; conditions</label><span style="color:#FF0000; margin-left:-10px;">*</span>
                        <?php echo $form->error($profile, 'termcondition'); ?>
                    </div>

                    <div class="common flatui">
                        <?php echo CHtml::CheckBox('RegistrationForm[issubscribe]', $profile->user->issubscribe, array('value' => '1', 'autocomplete' => 'off')); ?><label><?php echo Message::SUBSCRIVE_NEWS_LETTER; ?></label>
                    </div>


                </div>
            </div>

            <div class="common">
                <p class="alignR">
                    <?php echo GxHtml::submitButton(Yii::t('app', 'Save'), array('class' => 'btn twoBtn')); ?>
            </div>
        </fieldset>
        <?php $this->endWidget(); ?>
    </div>
</div>
<style>
    div.box div.overlay{display:none;}
    div.box:hover div.overlay{display:block; z-index:99999; position:absolute;}
</style>
<script type="text/javascript">
<?php if (!$isCorporate && !$corporateprogram->bank_name) { ?>
        $("#corporateIdA").hide(500);
<?php } else { ?>
        $("#corporateIdA").show(500);
<?php } ?>
</script>	
<script type="text/javascript">
    function showCorporate(id) {
        var checkChecked = $('#' + id).is(':checked');
        if (checkChecked) {
            $("#corporateIdA").show(500);
        } else {
            $("#corporateIdA").hide(500);
        }
    }

    function deletePhoto() {
        var returnConfirm = confirm('Are you sure want to delete profile picture?');
        if (returnConfirm == true) {
            $.ajax({
                url: "<?php echo $deletePicureUrl; ?>profile_id/<?php echo $profile->profile_id; ?>",
                type: "post",
                data: "delete=1 & profile_id=<?php echo $profile->profile_id; ?>",
                dataType: "html",
                success: function(msg) {
                    if (msg == 'deleted') {
                        $('#userPhoto').html('<img src="<?php echo baseUrl() . '../../upload/'; ?>default-male.jpg" title="No Photo" height="200px" width="200px" />');
                    }
                }
            });
        }
    }

</script>
<script type="text/javascript">
    jQuery(document).ready(function() {

        $('.actype').fancyfields();
        $(".flatui").fancyfields();
        $(".ffCheckbox").fancyfields({
            onCheckboxChange: function(input, isChecked) {
                if (isChecked) {
                    $("#corporateIdA").show(500);
                } else {
                    $("#corporateIdA").hide(500);
                }
            }
        });
        $("#demoReset").click(function() {
            $(".flatui").fancyfields("reset");
        });
    });
</script>

<script type="text/javascript" src="<?php echo ThemePath(); ?>/js/jquery.nicescroll.js"></script>
<script>
    $(window).ready(function() {

        $("#descriptionTabs").niceScroll({touchbehavior: true, autohidemode: true});
    });
</script>
<!--Terms and Condition Scroll Plugin-->
<script>
    $(window).ready(function() {
        $("#termsBox").niceScroll({touchbehavior: true, autohidemode: true});

    });
</script>
<script>
    window.onload = pre_loader;
    function pre_loader() {
        javascript:document.getElementById('contentCntr').removeAttribute('id');
    }


</script>